Change PaginatedResult next / first / current to be methods#430
Conversation
I made these async throwing properties in 20e7f5f, when first translating the public API from JavaScript to Swift. I think it might have just been because of eagerness to use a new language feature. But looking at the proposal that introduced this feature [1] I can't fully convince myself that it's intended for things that go and make an HTTP request. Let's just use methods, for consistency with other platforms. [1] https://github.com/swiftlang/swift-evolution/blob/main/proposals/0310-effectful-readonly-properties.md
WalkthroughConverted asynchronous throwing computed properties (next, first, current) into async throwing methods across the pagination protocol, wrapper, mocks, and tests. Updated all call sites to invoke methods with parentheses. No other behavioral changes are indicated. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor T as Test/Client
participant P as PaginatedResult (Protocol)
participant W as PaginatedResultWrapper
participant S as Underlying SDK
Note over P,W: Pagination API changed: properties → methods
T->>P: next() / first() / current() (async)
activate P
P->>W: delegate call (async)
activate W
W->>S: request page (async)
alt success
S-->>W: page/result
W-->>P: wrapped result
P-->>T: result (Self / Self?)
else error
S-->>W: error (ARTErrorInfo)
W-->>P: throw ARTErrorInfo
P-->>T: throw ARTErrorInfo
end
deactivate W
deactivate P
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (4)
🧰 Additional context used📓 Path-based instructions (2)Sources/**/*.swift📄 CodeRabbit inference engine (CLAUDE.md)
Files:
Tests/AblyChatTests/**/*.swift📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧬 Code graph analysis (4)Sources/AblyChat/PaginatedResult.swift (3)
Example/AblyChatExample/Mocks/Misc.swift (3)
Tests/AblyChatTests/DefaultMessagesTests.swift (5)
Tests/AblyChatTests/MessageSubscriptionResponseAsyncSequenceTests.swift (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (12)
🔇 Additional comments (6)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
TODO squash once #430 merged
I made these async throwing properties in 20e7f5f, when first translating the public API from JavaScript to Swift. I think it might have just been because of eagerness to use a new language feature. But looking at the proposal that introduced this feature I can't fully convince myself that it's intended for things that go and make an HTTP request. Let's just use methods, for consistency with other platforms.
Summary by CodeRabbit
Refactor
Tests
Chores